package ns2;

import java.io.Serializable;

import util.Connections;
import util.Nodes;
import util.Traces;

public class Node implements Serializable {

	private static final long serialVersionUID = 111L;

	public int id;

	public Nodes neighbours;

	public boolean isRouter;

	public Traces allTraces;

	public Traces normalTraces;

	public Traces intrusionTraces;

	public Connections connections;

	private float riskProfile;

	private float loadFactor;

	private float disruptionCost;

	public Node(int id) {
		this.id = id;
		this.neighbours = new Nodes();
		this.isRouter = false;
		this.allTraces = new Traces();
		this.normalTraces = new Traces();
		this.intrusionTraces = new Traces();
		this.connections = new Connections();
		this.riskProfile = 1;
		this.loadFactor = 1;
		this.disruptionCost = 1;
	}

	public void log(Trace trace) {
		this.allTraces.addTrace(trace);
	}

	public long getNumOfAllPkts() {
		return this.allTraces.size();
	}

	public int getNumOfConnections() {
		return this.connections.size();
	}

	public void compact() {
		this.allTraces.trimToSize();
		this.connections.trimToSize();
		this.neighbours.trimToSize();
	}

	public void reset() {
		this.allTraces.clear();
	}

	public float getRiskProfile() {
		return riskProfile;
	}

	public void setRiskProfile(float riskProfile) {
		this.riskProfile = riskProfile;
	}

	public float getLoadFactor() {
		return loadFactor;
	}

	public void setLoadFactor(float loadFactor) {
		this.loadFactor = loadFactor;
	}

	public float getDisruptionCost() {
		return disruptionCost;
	}

	public void setDisruptionCost(float disruptionCost) {
		this.disruptionCost = disruptionCost;
	}
}
